/*****************************************************************//**
 * \file   AnsysReaderMgr.h
 * \brief  AnsysReaderMgr
 *
 * \author Wyatt
 * \date   May 2023
 *********************************************************************/
#pragma once

#include <string>
#include <unordered_map>

#include "AnsysDef.h"

class CDBReader;
class ReaderBase;
class ReaderMgr
{
public:
	ReaderMgr(void);
	virtual ~ReaderMgr(void);

	static ReaderMgr* Inst();
	bool Regist(ReaderBase* pReader);

	ReaderBase* GetReader(ANSYS_KEYWORD keyw);
	ANSYS_KEYWORD KeyType(std::string& keystr);

	bool Scan(std::string& strDataLine);
	bool Read(std::string& strDataLine);
	bool Build();

	void AddKeyWordSupport(std::string newKeyWord, std::string oldKeyWord)
	{
		readerStrMap[newKeyWord] = readerStrMap[oldKeyWord];
	};

	bool destroy_data();

	static ReaderMgr* _inst;
protected:
	std::unordered_map<ANSYS_KEYWORD, ReaderBase*, EnumClassHash> readerMap;
	std::unordered_map<std::string, ANSYS_KEYWORD> readerStrMap;
	CDBReader* _pCDBReader{};
	
};
